package com.heima.mapper;

import com.github.pagehelper.Page;
import com.heima.annotation.AutoFill;
import com.heima.enums.OperationType;
import com.heima.pojo.Partner;
import com.heima.pojo.dto.PagePartnerDto;
import com.heima.pojo.vo.PartnerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface PartnerMapper {

    @AutoFill(OperationType.INSERT)
    Integer insertPartner(Partner partner);

    Page<Partner> findByName(PagePartnerDto pagePartnerDto);

    PartnerVo queryPartner(Long id);

    @AutoFill(OperationType.UPDATE)
    Integer modifyPartner(Partner partner);

    Integer deletePartner(Integer id);

    Integer queryVmCount(Integer id);

    @Select("select city from tb_partner where id = #{ownerId}")
    String cityCode(Integer ownerId);
}
